package com.senven.role.controller;

import com.senven.common.entity.Role;
import com.senven.common.vo.CommonResult;
import com.senven.role.service.RoleSerive;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 传递给其他微服务的接口
 */
@RestController
@RequestMapping(value = "/role/api")
@Api(tags = "role传给其他微服务的接口")
public class apiRoleController {
    @Autowired
    private RoleSerive roleSerive;
    @ApiOperation(value = "查询全部角色的接口")
    @RequestMapping(value = "/findAllRole")
    public List<Role> findAllRole(){
     return roleSerive.findAllRole();
    }


    @ApiOperation(value = "修改角色名字")
    @RequestMapping(value = "/updateRole")
    public CommonResult updateRole(Role role){
        return roleSerive.updateRole(role);
    }
    @ApiOperation(value = "根据角色id查询roleid")
    @RequestMapping(value ="/findRoleidByUserid")
    public CommonResult findRoleByUserid(@RequestBody String userid){
        return roleSerive.findRoleidByUserid(userid);
    }
}
